#include <chrono>
#include <iostream>
#include <thread>

#include "ThreadPool.hpp"

void task_func(int id)
{
    std::this_thread::sleep_for(std::chrono::seconds(1));
    std::cout << "Task " << id << " executed in thread " << std::this_thread::get_id() << std::endl;
    char name[16];
    pthread_getname_np(pthread_self(), name, sizeof(name));
    std::cout << "Thread name: " << name << std::endl;
}

int main()
{
    ThreadPool pool(2);

    while (1)
    {
        for (int i = 0; i < 10; i++)
        {
            pool.submit([i]() { task_func(i); }, "thread_is_" + std::to_string(i));
        }
    }
    return 0;
}
